All right.
So now that we have our eruption script expanding our lava flow out, let's add the drain effect so
it drains down when it's done.
Let's go to lava and then eruption.
And then I have this eruption or erupt function.
I'm going to copy it, Control C because drain is going to be very similar to control V to paste it,
I'm going to add drain and then I'm not going to change size, I'm going to change position.
I'm going to drop the very large Liverpool down really slow.
So I'll say lava dot position equals lava dot position and then we'll add a vector three.
But I'm going to keep the X and the Z zero.
Y will be the height because we're dealing with possessions.
It doesn't matter that we rotated the part, we're going to make this -0.01.
It's going to drain down slower.
Right?
But if you'll notice, this grew by 0.03, but it grew out of the center.
So each loop iteration, it actually increased by 0.015 this one.
We're going to have to increase this number or we're going to have lava left over and then it'll just
disappear.
Let's increase this three times.
Let's increase that to 40, because we might have subtractions in the terrain or erosions and we want
to see it drain all the way down.
I'm also going to get rid of that 0.1.
I'm going to use the default weight value, which is 0.0 3 seconds about that.
Right.
0.029999.
Like that when we get to the end of our drain.
I want to put the lava flow back to its original size and original position because we're going to do
this periodically in the game and we want it to be ready.
So I'm going to go up to the top of the script.
I'm going to save off the original position and I'll call that POS lava dot position.
And then size is lava dot size.
So I'm saving the original size and the original position right here.
When we get to the end of our drain, I'm going to say lava dot position.
Bring it back to the original position.
Lava dot size.
Bring it back to the original size.
Cool.
Now we just need to call this so after the erupt, let's wait.
I don't know.
Maybe a second.
And then we'll start draining.
See what we got.
Play here.
Here we go.
Let's get high ground.
Even though there's no damage yet.
Right?
It expands out.
We could make it expand all the way out if we wanted.
And now we're going to watch it drop.
That's pretty cool.
All right.
Next video, we'll do damage and now we need an eruption.
Sound to.